import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    // {
    //   path: '/',
    //   redirect: '/about',
    // },
    {
      path: '/home',
      name: 'home',
      component: () => import('./views/Home.vue'),
      meta: { title: '首页', permission: false },
      children: [
        {
          keepAlive: true,
          path: '/about',
          name: 'about',
          meta: { title: '关于', permission: true },
          component: () => import('./views/About.vue'),
        },
        {
          keepAlive: true,
          path: '/info',
          name: 'info',
          meta: { title: '消息', permission: true },
          component: () => import('./views/Info.vue'),
        },
        {
          keepAlive: true,
          path: '/message',
          name: 'message',
          meta: { title: '消息', permission: true },
          component: () => import('./views/Message.vue'),
        },

        // 管理菜单
        {
          keepAlive: true,
          path: '/manageabout',
          name: 'manageabout',
          meta: { title: '关于', permission: true },
          component: () => import('./views/ManagerAbout.vue'),
        },
        {
          keepAlive: true,
          path: '/manageinfo',
          name: 'manageinfo',
          meta: { title: '消息', permission: true },
          component: () => import('./views/ManagerInfo.vue'),
        },
        {
          keepAlive: true,
          path: '/managemessage',
          name: 'managemessage',
          meta: { title: '消息', permission: true },
          component: () => import('./views/MamagerMessage.vue'),
        },
        {
          keepAlive: true,
          path: '/addbuilding',
          name: 'addbuilding',
          meta: { title: '消息', permission: true },
          component: () => import('./views/AddBuilding.vue'),
        },
        {
          keepAlive: true,
          path: '/roomInfo',
          name: 'roomInfo',
          meta: { title: '消息', permission: true },
          component: () => import('./views/RoomInfo.vue'),
        },
        {
          keepAlive: true,
          path: '/addroom',
          name: 'addroom',
          meta: { title: '消息', permission: true },
          component: () => import('./views/AddRoom.vue'),
        },
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('./views/Login.vue'),
      meta: { title: '登录' },
    },

    {
      path: '/403',
      name: '403',
      meta: { title: '无权限' },
      component: () => import('./components/403.vue'),
    },
    {
      path: '*',
      name: '404',
      meta: { title: '页面没找到' },
      component: () => import('./components/404.vue'),
    },
  ],
})
